package com.kede.api.stand.controller;

import com.kede.api.stand.dto.BuildPackageDTO;
import com.kede.api.stand.service.IPackageManageServer;
import com.kede.ienum.order.CertiTypeEnum;
import com.kede.pojo.PackageStatusEnum;
import com.kede.pojo.PagePO;
import com.kede.pojo.ResHttp;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author:Pr.li
 * @Date: create in 2023/9/16 11:01
 */
@RestController
@RequestMapping("package")
public class PackageController {

    @Resource
    private IPackageManageServer packageManageServer;

    /**
     * 创建打包
     * @param buildPackageDTO
     * @return
     */
    @PostMapping("buildPackage")
    public ResHttp buildPackage(@RequestBody BuildPackageDTO buildPackageDTO){
        return packageManageServer.buildPackage(buildPackageDTO);
    }

    @GetMapping("getMyPackage")
    public ResHttp getMyPackage(PagePO pagePO, Integer cerId, CertiTypeEnum type, PackageStatusEnum status){
        return packageManageServer.getMyPackage(pagePO,cerId,type,status);
    }

    @GetMapping("getPackageDetail")
    public ResHttp getPackageDetail(Integer id,CertiTypeEnum type){
        return packageManageServer.getPackageDetail(id,type);
    }


    @GetMapping("removeGood")
    public ResHttp removeGood(Integer packageId,Integer goodId){
        return packageManageServer.removeGood(packageId,goodId);
    }

    @GetMapping("removePkg")
    public ResHttp removePkg(Integer packageId){
        return packageManageServer.removePkg(packageId);
    }

    @GetMapping("normalPkg")
    public ResHttp normalPkg(Integer packageId,CertiTypeEnum typeEnum){
        return packageManageServer.normalPkg(packageId, typeEnum);
    }

    @GetMapping("getParentInfoByAddress")
    public ResHttp getParentInfoByAddress(CertiTypeEnum type,String addres){
        return packageManageServer.getParentInfoByAddress(type,addres);
    }

}
